<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

defined('ANS') or die();

$Data->execute('check.php', true);

$Admin->selectRelations(array(
	'table' => $Vars->get('table'),
	'search' => $Vars->str('q'),
	'page' => $Vars->int('page'),
	'relation' => $Vars->get('relation'),
	'relation_id' => $Vars->get('relation_id'),
	'all' => $Vars->bool('all')
), 'list');

$relation_info = $Admin->Data->tableArray($Vars->get('relation'));
$relation_table = $Admin->Data->getTable($relation_info['realname']);
$relation = $relation_table->getRelation($Vars->get('table'), $relation_info['name'], $relation_info['direction']);

$relation = $relation->settings;

$Vars->setData('table_info', array(
	'title' => $Admin->info('name', $relation['tables'][1]),
	'description' => $Admin->info('description', $relation['tables'][1]),
	
	'relation_direction' => $relation['direction'][1],
	'relation_name' => $relation['name'],
	'relation_table' => $Admin->info('name', $relation['tables'][0]),
));
?>
